package com.bwjf.authority.commons.base.entity;

import com.alibaba.fastjson.JSONObject;

/**
 * 带参数的结果
 * @author llq
 *
 */
public class ResultData<T> {
    private Boolean state;
    private String msg;
    private T data;
    
    public ResultData(boolean state,String msg,T data){
        this.state=state;
        this.msg=msg;
        this.data=data;
    }
    
    public ResultData(boolean state,String successMsg,String errorMsg,T data){
        this.state=state;
        this.msg=state?successMsg:errorMsg;
        this.data=data;
    }

    public Boolean getState() {
        return state;
    }

    public void setState(Boolean state) {
        this.state = state;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public T getData() {
        return data;
    }

    public void setData(T data) {
        this.data = data;
    }
    
    public String toJSONString(){
        return JSONObject.toJSONString(this);
    }
}
